package com.zzb.framework.starter.xxljob.utils;

import com.xxl.job.core.biz.model.ReturnT;
import com.zzb.framework.common.BaseResponse;

/**
 * ReturnT转成Response
 */
public class ReturnTConverter {
    public static <T> BaseResponse<T> convert(ReturnT<T> returnT) {
        BaseResponse baseResponse = new BaseResponse();
        baseResponse.setContent(returnT.getContent());
        baseResponse.setStatus(returnT.getCode() == ReturnT.SUCCESS_CODE ? BaseResponse.SUCCESS : BaseResponse.FAIL);
        baseResponse.setMsg(returnT.getMsg());
        return baseResponse;
    }
}
